<template>
  <div class="hello">
    <div id="annualpie" style="height: 500px;width: 500px;"></div>
  </div>
</template>

<script>
  import * as echarts from 'echarts';
export default {
  name: 'HelloWorld',
  components: {},
  props: {
    msg: String
  },
  data(){
    return{
      testPie:[
        {value: 1048, name: '车型一'},
        {value: 735, name: '车型二'},
        {value: 94, name: '车型三'},
      ],
    }
  },
  mounted() {
    this.initAnnualpie()
  },
  methods:{
    initAnnualpie(){
      var options={
        tooltip: {
          trigger: 'item'
        },
        legend: {

          orient: 'vertical',
          left: 'right',
          y:'top',
          fontSize:'40px',
        },
        series: [
          {
            name: '在线车型统计',
            type: 'pie',
            radius: ['60%', '80%'],
            avoidLabelOverlap: false,
            itemStyle: {
              left: 'left',
              borderRadius: 10,
              borderColor: '#fff',
              borderWidth: 2
            },
            label: {
              show: false,
              position: 'center'
            },
            emphasis: {
              label: {
                show: true,
                fontSize: '20',
                fontWeight: 'bold'
              }
            },
            labelLine: {
              show: false
            },
            data: this.testPie,
          }
        ]
      };
      let pieChart = echarts.init(document.getElementById('annualpie'));
      pieChart.setOption(options)
    },
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
